/*     */ package com.zimbra.cs.db;
/*     */ 
/*     */ import java.sql.Connection;
/*     */ import java.sql.PreparedStatement;
/*     */ import java.sql.SQLException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class RetryConnection
/*     */   extends DebugConnection
/*     */ {
/*     */   RetryConnection(Connection conn)
/*     */   {
/*  30 */     super(conn);
/*     */   }
/*     */   
/*     */   public PreparedStatement prepareStatement(final String sql) throws SQLException
/*     */   {
/*  35 */     final RetryConnection conn = this;
/*  36 */     AbstractRetry<PreparedStatement> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<PreparedStatement> execute() throws SQLException {
/*  39 */         return new ExecuteResult(new RetryPreparedStatement(conn, RetryConnection.this.mConn.prepareStatement(sql), sql));
/*     */       }
/*     */       
/*  42 */     };
/*  43 */     return (PreparedStatement)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency)
/*     */     throws SQLException
/*     */   {
/*  51 */     final RetryConnection conn = this;
/*  52 */     AbstractRetry<PreparedStatement> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<PreparedStatement> execute() throws SQLException {
/*  55 */         return new ExecuteResult(new RetryPreparedStatement(conn, RetryConnection.this.mConn.prepareStatement(sql, resultSetType, resultSetConcurrency), sql));
/*     */       }
/*     */       
/*     */ 
/*  59 */     };
/*  60 */     return (PreparedStatement)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public PreparedStatement prepareStatement(final String sql, final int resultSetType, final int resultSetConcurrency, final int resultSetHoldability)
/*     */     throws SQLException
/*     */   {
/*  68 */     final RetryConnection conn = this;
/*  69 */     AbstractRetry<PreparedStatement> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<PreparedStatement> execute() throws SQLException {
/*  72 */         return new ExecuteResult(new RetryPreparedStatement(conn, RetryConnection.this.mConn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability), sql));
/*     */       }
/*     */       
/*     */ 
/*  76 */     };
/*  77 */     return (PreparedStatement)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   public PreparedStatement prepareStatement(final String sql, final int autoGeneratedKeys)
/*     */     throws SQLException
/*     */   {
/*  83 */     final RetryConnection conn = this;
/*  84 */     AbstractRetry<PreparedStatement> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<PreparedStatement> execute() throws SQLException {
/*  87 */         return new ExecuteResult(new RetryPreparedStatement(conn, RetryConnection.this.mConn.prepareStatement(sql, autoGeneratedKeys), sql));
/*     */       }
/*     */       
/*  90 */     };
/*  91 */     return (PreparedStatement)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   public PreparedStatement prepareStatement(final String sql, final int[] columnIndexes)
/*     */     throws SQLException
/*     */   {
/*  97 */     final RetryConnection conn = this;
/*  98 */     AbstractRetry<PreparedStatement> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<PreparedStatement> execute() throws SQLException {
/* 101 */         return new ExecuteResult(new RetryPreparedStatement(conn, RetryConnection.this.mConn.prepareStatement(sql, columnIndexes), sql));
/*     */       }
/*     */       
/* 104 */     };
/* 105 */     return (PreparedStatement)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   public PreparedStatement prepareStatement(final String sql, final String[] columnNames)
/*     */     throws SQLException
/*     */   {
/* 111 */     final RetryConnection conn = this;
/* 112 */     AbstractRetry<PreparedStatement> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<PreparedStatement> execute() throws SQLException {
/* 115 */         return new ExecuteResult(new RetryPreparedStatement(conn, RetryConnection.this.mConn.prepareStatement(sql, columnNames), sql));
/*     */       }
/*     */       
/* 118 */     };
/* 119 */     return (PreparedStatement)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   public void commit()
/*     */     throws SQLException
/*     */   {
/* 125 */     AbstractRetry exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult execute() throws SQLException {
/* 128 */         RetryConnection.this.superCommit();
/* 129 */         return null;
/*     */       }
/* 131 */     };
/* 132 */     exec.doRetry();
/*     */   }
/*     */   
/*     */   private void superCommit() throws SQLException {
/* 136 */     super.commit();
/*     */   }
/*     */   
/*     */   public void rollback()
/*     */     throws SQLException
/*     */   {
/* 142 */     AbstractRetry exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult execute() throws SQLException {
/* 145 */         RetryConnection.this.superRollback();
/* 146 */         return null;
/*     */       }
/* 148 */     };
/* 149 */     exec.doRetry();
/*     */   }
/*     */   
/*     */   private void superRollback() throws SQLException {
/* 153 */     super.rollback();
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/db/RetryConnection.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */